Dynamic programming for probability of knight in chessboard